package hn.sigit.model.hnd.ladmshadow;

import hn.sigit.model.ladm.spatialunit.LA_LevelContentType;
import hn.sigit.model.ladm.spatialunit.LA_RegisterType;
import hn.sigit.model.ladm.spatialunit.LA_StructureType;

import java.io.Serializable;
import javax.persistence.*;


@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="Level", schema="ladmshadow")
@Inheritance(strategy=InheritanceType.JOINED)
public class Level extends AssociationInfo implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long IID;
	private String name;
	private LA_RegisterType registerType;
	private LA_StructureType structure;
	private LA_LevelContentType type;
	private java.util.Set<SpatialUnit> su = new java.util.HashSet<SpatialUnit>();
	
	public Level() {
	}
	
	@Id
	@Column(name="ID", nullable=false)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="shw_level_id_gen")
	@SequenceGenerator(name="shw_level_id_gen", sequenceName="shw_level_id_seq", allocationSize=1)
	public long getIID() {
		return IID;
	}
	protected void setIID(long value) {
		this.IID = value;
	}
	@Transient
	public long getORMID() {
		return getIID();
	}
	
	@Column(name="Name", nullable=true, length=255)	
	public String getName() {
		return name;
	}
	public void setName(String value) {
		this.name = value;
	}
	
	@Column(name="RegisterType", nullable=true)
	@Enumerated(EnumType.STRING)
	public LA_RegisterType getRegisterType() {
		return registerType;
	}
	public void setRegisterType(LA_RegisterType value) {
		this.registerType = value;
	}
	
	@Column(name="Structure", nullable=true)
	@Enumerated(EnumType.STRING)
	public LA_StructureType getStructure() {
		return structure;
	}
	public void setStructure(LA_StructureType value) {
		this.structure = value;
	}
	
	@Column(name="Type", nullable=true)
	@Enumerated(EnumType.STRING)
	public LA_LevelContentType getType() {
		return type;
	}
	public void setType(LA_LevelContentType value) {
		this.type = value;
	}
	
	@OneToMany(mappedBy="level", targetEntity=SpatialUnit.class)
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)
	public java.util.Set<SpatialUnit> getSu() {
		return su;
	}
	public void setSu(java.util.Set<SpatialUnit> value) {
		this.su = value;
	}
	
	public String toString() {
		return super.toString();
	}
	
}
